# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
pkgname=intel-ucode
pkgver=20200616
pkgrel=0
pkgdesc="Microcode update files for Intel CPUs"
arch="x86 x86_64"
url="https://downloadcenter.intel.com/SearchResult.aspx?lang=eng&keyword=%22microcode%22"
license="custom"
makedepends="iucode-tool"
source="https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/archive/microcode-$pkgver.tar.gz"
options="!check"
builddir="$srcdir/Intel-Linux-Processor-Microcode-Data-Files-microcode-$pkgver"

build() {
	rm -f intel-ucode/list intel-ucode-with-caveats/list
	mkdir -p kernel/x86/microcode
	iucode_tool -w kernel/x86/microcode/GenuineIntel.bin \
		intel-ucode/ intel-ucode-with-caveats/
	echo kernel/x86/microcode/GenuineIntel.bin | \
		 cpio -o -H newc -R 0:0 > intel-ucode.img
}

package() {
	install -D -m0644 intel-ucode.img "$pkgdir"/boot/intel-ucode.img
	install -Dm644 license "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

sha512sums="39c4de3a292da0aeef4f35624d22ca6116dc8baa7f0683b1c16f5e153ba6d9d52f0879263313ef67922eda551d998521d3721af880c22c63083d8ebce81f413f  microcode-20200616.tar.gz"
